home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / WAIS / next-ui / BrowserPane.h < prev    next >
Encoding:
Text File  |  1992-02-23  |  4.7 KB  |  137 lines

  1. // BrowserPane.h
  2. //
  3. // Free software created 1 Feb 1992
  4. // by Paul Burchard <burchard@math.utah.edu>.
  5. //
  6. // Provides a scrolling list of strings in NX_LISTMODE; i.e. its entries may be
  7. // multiply selected in all the usual ways.  The strings are all distinct 
  8. // (although displayed abbreviations may not be---see below); entering an
  9. // existing string has no effect.
  10. //
  11. // The stringValue of the BrowserPane is a TAB-separated list of the selected 
  12. // strings.  Selecting entries sends the action to the target.  The selection
  13. // can be adjusted by mouse, via selectEntryAt::, or via methods which change 
  14. // the stringValue (such as takeStringValueFrom:, appendStringValueFrom:).
  15. // Double-clicking selects that single entry, sends the doubleAction to the 
  16. // target, and sends an openFile:: message to the delegate (if any).  Note:
  17. // action methods which set the string value won't send the action to the
  18. // target if the target is the same as the sender (to avoid circularity).
  19. // The separator character (TAB) can be changed to any non-null character.
  20. //
  21. // The strings may be displayed in alphabetized and/or abbreviated form.  The
  22. // default isFirst:second: comparison method uses NXOrderStrings(); the default
  23. // abbreviate: method is to take the final ``path component'' of a file name.
  24. // (Note: abbreviations must not be longer than originals.)  Alphabetization 
  25. // uses abbreviated values.  [Note...currently the setAlphabetized: method 
  26. // isn't retroactive; call it before entering any data.]
  27. //
  28. // If isEditable is set, then the standard NeXT editing operations (and Delete)
  29. // will work (pasteboard interaction uses same format as stringValue) once the 
  30. // object is made FirstResponder (by clicking on it).  This object displays its 
  31. // FirstResponder status by highlighting itself.  It allows the -copy: 
  32. // operation whether or not it is editable.  The delegate (if any) will be sent 
  33. // a removeFile:ok: message upon Cut or Delete operations, and a prepFile:ok: 
  34. // message on Copy.  The delegate will also receive a -textDidChange: message
  35. // when the contents of the list are changed due to user actions.
  36. //
  37. // Entries may be disabled; their text is dimmed and not selectable.  To make 
  38. // new entries disabled by default, set the isDisabledOnEntry flag.
  39. //
  40. // Both the action and the doubleAction are by default takeStringValueFrom:.
  41. //
  42. // If the -initFrame:cellClass: initializer is used, the cell class should be 
  43. // a subclass of TextFieldCell.
  44. //
  45.  
  46. #import <appkit/appkit.h>
  47.  
  48. @interface BrowserPane : ScrollView
  49. {
  50.     id stringValue;
  51.     id stringList;
  52.     id delegate;
  53.     id target;
  54.     SEL action;
  55.     SEL doubleAction;
  56.     BOOL isAlphabetized;
  57.     BOOL isAbbreviated;
  58.     BOOL isEditable;
  59.     BOOL isDisabledOnEntry;
  60.     char separator;
  61. }
  62.  
  63. - initFrame:(const NXRect *)frameRect;
  64. - initFrame:(const NXRect *)frameRect cellClass:factoryId;
  65. - free;
  66.  
  67. // Target, action, and value.
  68. - setTarget:anObject;
  69. - setAction:(SEL)aSelector;
  70. - setDoubleAction:(SEL)aSelector;
  71. - target;
  72. - (SEL)action;
  73. - (SEL)doubleAction;
  74. - sendAction;
  75. - sendDoubleAction;
  76. - takeStringValueFrom:sender;
  77. - appendStringValueFrom:sender;
  78. - setStringValue:(const char *)aString;
  79. - setStringValue:(const char *)aString append:(BOOL)flag;
  80. - (char)separator;
  81. - setSeparator:(char)c;
  82.  
  83. // Editing.
  84. - setEditable:(BOOL)yn;
  85. - (BOOL)isEditable;
  86. - cut:sender;
  87. - copy:sender;
  88. - paste:sender;
  89. - delete:sender;
  90. - selectAll:sender;
  91. - keyDown:(NXEvent *)theEvent;
  92. - mouseDown:(NXEvent *)theEvent;
  93.  
  94. // Responding to changes in environment.
  95. - (BOOL)acceptsFirstResponder;
  96. - becomeFirstResponder;
  97. - resignFirstResponder;
  98. - read:(NXTypedStream *)stream;
  99. - write:(NXTypedStream *)stream;
  100. - resizeSubviews:(const NXSize *)oldSize;
  101.  
  102. // Delegated file operations and user-induced text change notification.
  103. - (int)openFile:(const char *)fileName ok:(int *)flag;
  104. - (int)prepFile:(const char *)fileName ok:(int *)flag;
  105. - (int)removeFile:(const char *)fileName ok:(int *)flag;
  106. - textDidChange:sender;
  107.  
  108. // Managing the list.
  109. - clear;
  110. - clearSelection;
  111. - addEntry:(const char *)aString;
  112. - (int)indexAddEntry:(const char *)aString;
  113. - (const char *)entryAt:(int)row;
  114. - removeEntryAt:(int)row;
  115. - removeSelection;
  116. - (unsigned)count;
  117. - addFiles:(const char *)dir suffix:(const char *)sfx;
  118. - selectEntryAt:(int)row append:(BOOL)yn;
  119. - (BOOL)isEntrySelectedAt:(int)row;
  120. - (int)indexOfEntry:(const char *)aString;
  121. - setEntryEnabled:(BOOL)yn at:(int)row;
  122. - (BOOL)isEntryEnabledAt:(int)row;
  123. - setDisabledOnEntry:(BOOL)yn;
  124. - (BOOL)isDisabledOnEntry;
  125. - setAlphabetized:(BOOL)yn;
  126. - (BOOL)isAlphabetized;
  127. - (BOOL)isFirst:(const char *)firstString second:(const char *)secondString;
  128. - setAbbreviated:(BOOL)yn;
  129. - (BOOL)isAbbreviated;
  130. - abbreviate:(const char *)srcString to:(char *)destString;
  131.  
  132. // Accessing Cells for enhanced functions.
  133. - cellAt:(int)row;
  134.  
  135. @end
  136.  
  137.